/**
 * 
 */
package testy;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import poker.*;

/**
 * @author Administrator
 *
 */
public class BotTest {

	static Table testTable;
	static ShittyBot testPlayer1;
	static AdvancedBot testPlayer2;
	static HandScore testHand1, testHand2;
	
	/**
	 * @throws java.lang.Exception
	 */
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		testTable = new Table(null);
		testPlayer1 = new ShittyBot(testTable);
		testPlayer2 = new AdvancedBot(testTable);
	}

	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		testPlayer1.reset();
		testPlayer2.reset();
		testTable.deal();

	}

	/**
	 * @throws java.lang.Exception
	 */
	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testBotAI() {
		testTable.setup(testPlayer1,testPlayer2);
		int ShittyBotScore = 0;
		int AdvancedBotScore = 0;
		
		for ( int i=0; i<50000; i++ ) {
			testTable.deal();
			testTable.start();
			Player w = testTable.scores.get(testTable.playerCount-1).player;
			
			if ( w == testPlayer1 ) ShittyBotScore++;
			if ( w == testPlayer2 ) AdvancedBotScore++;
		}
		
		System.out.println("Advanced Bot wins = "+Integer.toString(AdvancedBotScore)+", Shitty Bot wins = "+Integer.toString(ShittyBotScore));
		assertTrue("Advanced Bot wins = "+Integer.toString(AdvancedBotScore)+", Shitty Bot wins = "+Integer.toString(ShittyBotScore),AdvancedBotScore > ShittyBotScore);
	}

}
